package com.zyz.bookborrowing.bean;

import java.util.List;

public class PageBean<Book> {
    private List<Book> pageData;	// 分页结果集
    private int totalCount = 0 ;	// 总记录数
    private int currentPage = 1;	// 当前页
    private int pageSize = 6;	    // 每页记录数
    private int totalPage = 1;		// 总页数
    private int startNum = 0;	    // 开始行号
    private int endNum = 1;         // 结尾行号

    public List<Book> getPageData() {
        return pageData;
    }
    public void setPageData(List<Book> pageData) {
        this.pageData = pageData;
    }
    public int getTotalCount() {
        return totalCount;
    }
    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }
    public int getCurrentPage() {
        return currentPage;
    }
    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }
    public int getPageSize() {
        return pageSize;
    }
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
    public int getTotalPage() {
        totalPage = totalCount / pageSize;
        if (totalCount == 0 || totalCount%pageSize != 0)  totalPage++;
        return totalPage;
    }
    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }
    public int getStartNum() {
        return (this.currentPage-1)*this.pageSize;
    }
    public void setStartNum(int startNum) {
        this.startNum = startNum;
    }
    public int getEndNum() {
        return this.currentPage*this.pageSize +1;
    }
    public void setEndNum(int endNum) {
        this.endNum = endNum;
    }
}
